<div style="margin-top: 0px; height: auto; overflow-x: hidden;background:#F2F2F2;">
<div  class="shadowBox" style="margin-bottom:10px">
<div class="height40 TextMiddle40 card_item_toolbar"><h3>我的报表</h3></div>
</div>
<div id="Report_records" class="cardItems">
</div>
</div>
<div class="tabLink" >
	<ul>
		<li><a href="javascript:myReportJs.prePage()">上一页</a></li>
		<li><a href="javascript:myReportJs.nextPage()">下一页</a></li>
	</ul>
</div> 

<div id="reportDiag"  class="easyui-dialog"  closed="true" style="width:900px;height:550px">
</div>
<script type="text/javascript">
(function(myReportJs, $, undefined ) {
	
	var total = 0;
	var currentPage = 1;
	var limit = 5;

	var reports = [];
	function refresh(){
		var start = (currentPage - 1) * limit;
		var url = "dispatch/utility/report/mine?start="+start+"&limit="+limit;
		workbenchJs.loadData(url,myReportJs.loadReportResult,"查询报告");
	}
	function rowOver(id){
		$(id).addClass('card_row-over');
	}
	function rowOut(id){
		$(id).removeClass('card_row-over');
	}
	myReportJs.doubleClick = function(id){
		var data = reports[id];
		reportJs.setData(data);
		$('#reportDiag').dialog("open");
		$('#reportDiag').dialog('refresh',data.theme);
		
	};
	myReportJs.nextPage = function()
	{
		if(currentPage * limit >= total)
		{
			$.messager.alert("Error",'已经是最后一页了');
		}else
		{
			currentPage = currentPage +1;
			refresh();
			
		}
	};
	myReportJs.prePage = function()
	{
		if(currentPage == 1)
		{
			$.messager.alert("Error",'已经是第一页了');
		}else
		{
			
			currentPage = currentPage -1;
			refresh();
		}
	};
	
	myReportJs.loadReportResult = function(result){
		
    	var res = result.result;
        if(res == "SUCCESS")
        {
        	var value = jQuery.parseJSON(result.payload.value);
        	total = value.total;
        	value = value.rows;
        	reports = value;
        	var id = 0;
        	var cc = [];
        	$(value).each(function(index){
        		var record = value[index];
        		id++;
        		var idName = "task_item_"+id;
        		cc.push('<div id="');
        		cc.push(idName);
        		cc.push('" class="card_item" ondblclick="javascript:myReportJs.doubleClick(');
        		cc.push(index);
        		cc.push(')"><div class="rappidLink_Pic"><img src="images/');
        		cc.push('chart-icon.png');
        		
        		cc.push('" style="width:50px;"></div><div class="card_otherInfo">');
        		
        		cc.push('<span class="card_label">标题  : ');
        		cc.push(record.title)
        		cc.push('</span><span class="card_label">创建时间: ');
        		cc.push(record.createDate);
        		cc.push('</span><p style="height:24px;line-height:24px;margin:0;padding:0">描述 : ');
        		cc.push(record.description);
        		cc.push('</p></div></div>');
        	});
        	
        	$('#Report_records').html(cc.join(''));
        	
    		$('.carditem').bind('mouseover',function(){
    			rowOver(this);
    		});
    		$('.carditem').bind('mouseout',function(){
    			rowOut(this);
    		});
        }else if(res == "COMPONENT_ERROR")
        {
        	$.messager.alert("Error",result.payload.value);
        }else
        {
        	$.messager.alert("Error",result.result);
        }
	};
	myReportJs.init = function(){
		
		refresh();
		//loadData("dispatch/utility/task/mine?type="+type+"&start=0&limit="+limit,loadReportResult);

	};
}( window.myReportJs = window.myReportJs || {}, jQuery ));

$(function(){
	myReportJs.init();
});
</script>
	    <style type="text/css">

    </style>